/**
 * @title GetTimeCommunicater.java
 * @package com.esun.cheetah.biz
 * @description 
 * @author liugan
 * @date 2012-4-26
 * @copyright 深圳市易讯天空
 */
package com.esun.cheetah.biz;

import java.util.HashMap;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Handler;
import android.os.Message;

import com.esun.cheetah.config.BizCode;
import com.esun.cheetah.config.Config;
import com.esun.cheetah.config.Key;
import com.esun.cheetah.network.AbsInferiorityCommunicater;

/**
 * @title GetTimeCommunicater
 * @description
 * @author liugan
 */
public class GetTimeCommunicater extends AbsInferiorityCommunicater {

	private String mTime;

	/**
	 * @param handler
	 */
	public GetTimeCommunicater(Handler handler) {
		super(handler);
	}

	@Override
	public HashMap<String, String> comHashMap() {
		HashMap<String, String> hmJson = new HashMap<String, String>();
		hmJson.put(Key.KEY_ID, BizCode.GET_REMOTE_TIME);
	//	hmJson.put("no", BizCode.GET_REMOTE_TIME);
		return hmJson;
	}

	@Override
	public void getJsonContent(String serverRes) throws JSONException {
		JSONObject jsonObject = new JSONObject(serverRes);
		mTime = jsonObject.getString(Key.KEY_DATA);

	}

	@Override
	public void getServerResponseSuccess() {
		Message msg = handlerFromAct.obtainMessage(Config.COMMUNICATER_SUCCESS);
		msg.obj = mTime;
		handlerFromAct.sendMessage(msg);
	}

}
